<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script> 
<script type="text/javascript" src="__STATIC__/js/jquery.ui.widget.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/js/jquery.fileupload.js" charset="utf-8"></script>
<div class="upload-con" id="uploader" style="display:none;overflow:auto;width:185px;">
	<div class="upload-progressall"></div>
	<div class="upload-txt"><span>支持Jpg、Png格式；浏览文件时可以按住ctrl或shift键多选。</span></div>
</div>
<script type="text/javascript">
$(function() {
	//鼠标触及区域li改变class
	var album_id = $("#album_id").val();
	var dataAlbum = {
		"album_id" : album_id,
		"thumb_type" : "big,mid,small,thumb",
		'file_path' : "system"
	};
	// ajax 上传图片
	var img_num = 0, // 上传图片的数量
		upload_num = 0; // 上传图片成功数量
	$('#fileupload').fileupload({
		url: "{:__URL('ADMIN_MAIN/system/imagetoalbum')}",
		dataType: 'json',
		formData:dataAlbum,
		add: function (e,data) {
			img_num ++;
			data.submit();
		},
		done: function (e,data) {
			var param = data.result;
			if(param.code > 0){
				upload_num++;
				$("#uploader").show();
				var progress = parseInt(upload_num / img_num * 100, 10);
				$('.upload-progressall').html('<p>已上传'+ progress +'%</p><div class="loading"><div style="width:'+progress+'%"></div></div>');
				LoadingInfo(1);
				if (upload_num == img_num) $("#uploader").hide();
			} else {
				showTip(param.message,"warning");
				$("#uploader").hide();
			}
		}
	});
});
</script>